import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from unit821.A3mall_sjk import py


deiver = webdriver.Edge()
deiver.get("http://10.59.9.12:7001/")
deiver.maximize_window()
time.sleep(2)

# 点击登录
deiver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
time.sleep(5)
# 用户名
deiver.find_element(By.XPATH,'//*[@id="theForm"]/div[1]/span[2]/input').send_keys("13811033962")
time.sleep(2)
# 密码
deiver.find_element(By.XPATH,'//*[@id="theForm"]/div[2]/span[2]/input').send_keys("123456")
time.sleep(10)
# 登录按钮
deiver.find_element(By.XPATH,'//*[@id="theForm"]/div[5]/a').click()
time.sleep(5)
# 断言 账户余额
dy1 = deiver.find_element(By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[4]/span').text
dy11 = dy1.replace("¥ ",'')
print(dy11)

yu = py().select('select amount from mall_users where username = "13811033962"')
print(yu[0][0])

assert float(dy11) == float(yu[0][0])